<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserBalanceRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_balance_records', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->tinyInteger('type')->default('1'); // 1 = 获得， 2 消费
            $table->string('type_desc'); // DISTRIBUTION 分销提成
            $table->decimal('amount'); //数量。
            $table->tinyInteger('status')->default(1); // 1=成功 0=失败
            $table->string('trade_no')->nullable();    // 分销提成时，记录订单号，提现时记录提现单号
            $table->string('comment'); //备注
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_balance_records');
    }
}
